package com.stone.demo

import android.os.Bundle
import android.widget.Button
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.fragment.app.FragmentActivity
import com.stone.core.HiLogger
import com.stone.demo.AppContext.Companion
import com.stone.demo.ui.fragment.SmartBottomSheetDialogFragment
import com.stone.demo.ui.theme.AppDemoTheme

class MainActivity : FragmentActivity() {

    companion object {
        const val TAG = "MainActivity"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        HiLogger.d(TAG, "onCreate")
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
        findViewById<Button>(R.id.btn).setOnClickListener {
            SmartBottomSheetDialogFragment().show(
                supportFragmentManager,
                "SmartBottomSheetDialogFragment"
            )
        }
    }

    override fun onStart() {
        super.onStart()
        HiLogger.d(TAG, "onStart")
    }

    override fun onResume() {
        super.onResume()
        HiLogger.d(TAG, "onResume")
    }

    override fun onPause() {
        super.onPause()
        HiLogger.d(TAG, "onPause")
    }


    override fun onStop() {
        super.onStop()
        HiLogger.d(TAG, "onStop")
    }


    override fun onDestroy() {
        super.onDestroy()
        HiLogger.d(TAG, "onDestroy")
    }

}


@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Text(
        text = "Hello $name!",
        modifier = modifier
    )
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    AppDemoTheme {
        Greeting("Android")
    }
}